#include "Common.fxh"

struct VS_INPUT
{
    float2 Pos : Position;
    float2 Tex : TexCoord;
};

struct PS_INPUT
{
    float4 Pos : SV_POSITION;
    float2 Tex : Tex;
};

struct PS_OUTPUT
{
	float4 Final : SV_TARGET;
};

PS_INPUT VS( VS_INPUT input)
{
	PS_INPUT output = (PS_INPUT)0;
	
	output.Pos = float4(input.Pos, 0, 1);
	output.Tex = input.Tex;
	
	return output;
}

PS_OUTPUT PS( PS_INPUT input)
{
	PS_OUTPUT output = (PS_OUTPUT)0;
	
	float3 diffuseColor = Diffuse.Sample(samLinear, input.Tex).rgb;
	float3 diffuseLight = DiffuseLight.Sample(samLinear, input.Tex).rgb;
	float specularLight = SpecularLight.Sample(samLinear, input.Tex).r;
	output.Final = float4(diffuseColor*diffuseLight + specularLight, 1);
	
	return output;
}

technique10 Render
{
    pass P0
    {
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetGeometryShader( NULL );
        SetPixelShader( CompileShader( ps_4_0, PS() ) );
    }
}